import os




if __name__ == "__main__":
    res = os.popen("docker ps").read()
    images = []
    for line in res.split("\n"):
        tmp = [i for i in line.split(" ") if i]
        if len(tmp) < 2:
            continue
        con_id = tmp[0]
        os.popen("docker stop %s && docker rm %s" % (con_id, con_id))